package model

import (
	"auth/model/entity"
)

type JobCreateRequest struct {
	JobName string `json:"job_name" binding:"required"`
}

type JobUpdateRequest struct {
	JobId int64 `json:"job_id"  binding:"required"`

	JobName string `json:"job_name" binding:"required"`
}

type JobListRequest struct {
	Index int `json:"index"`
	Size  int `json:"size"`

	JobId int64 `json:"job_id"`

	JobName string `json:"job_name"`
}

type JobListResponse struct {
	Total int        `json:"total"`
	Data  []*JobInfo `json:"data"`
}

type JobInfo struct {
	JobId int64 `json:"job_id"`

	JobName string `json:"job_name"`

	CreatedAt int64 `json:"created_at"`

	UpdatedAt int64 `json:"updated_at"`
}

type JobDeleteRequest struct {
	ID int64 `json:"id"  binding:"required"`
}

func JobsEntityToDto(jobs []*entity.Job) []*JobInfo {
	out := make([]*JobInfo, 0, len(jobs))
	for _, c := range jobs {
		out = append(out, JobEntityToDto(c))
	}
	return out
}

func JobEntityToDto(e *entity.Job) *JobInfo {
	return &JobInfo{

		JobId: e.JobId,

		JobName: e.JobName,

		CreatedAt: e.CreatedAt,

		UpdatedAt: e.UpdatedAt,
	}
}
